package com.leetcode.p0;


import java.util.ArrayList;
import java.util.List;

public class Test78 {

    List<Integer>       t   = new ArrayList<>();
    List<List<Integer>> res = new ArrayList<>();


    public List<List<Integer>> subsets(int[] nums) {

        dfs(0, nums);

        return res;
    }

    private void dfs(int cur, int[] nums) {
        if (nums.length == cur) {
            res.add(new ArrayList<>(t));
            return;
        }

        t.add(nums[cur]);
        dfs(cur + 1, nums);
        t.remove(t.size() - 1);

        dfs(cur + 1, nums);


    }


    public static void main(String[] args) {
        Test78 test = new Test78();
        System.out.println(test.subsets(new int[]{1, 2, 3}));
//        System.out.println(test.subsets(new int[]{1, 2}));
    }

}
